<?php 
include ('configuration.php'); 
	session_start();
	$var1= $_SESSION["registrado"];
	$var2= $_SESSION["administrador"];
	if ($var1 == null): {
		echo ("User not registered");
	} elseif ($var2 == 0): { 
			echo ("User without permissions");
	} else : {

	    //hago consulta con el id q me he traido del post de modifyMember y con eso me traigo todos los datos y relleno
	    $id_usu=$_POST['select_member'];
	    
	    if ($id_usu==0) { //esto significa que no se ha seleccionado ninguna opción
	        ?><script type="text/javascript">
	                  alert("You must select a member to modify");    
	                  history.back();
	             </script> 
	           <?php
	        }
	        else {
	            $q1 =  mysql_query ("SELECT name_member, surnames_member, mail_member  FROM project_member WHERE id_member='$id_usu'"); //ejecucion de la consulta
	            $q1_array = mysql_fetch_array($q1);
	            $name=$q1_array['name_member'];
	            $surname=$q1_array['surnames_member'];
	            $email=$q1_array['mail_member'];
	        
	    	?>



<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<link href="css/bootstrap.css" rel="stylesheet" media="screen">
<link href="css/bootstrap-responsive.css" rel="stylesheet"	media="screen">

<title>My project manager</title>

<style type="text/css">
  body {
    padding-top: 60px;
    padding-bottom: 40px;
  }
  .sidebar-nav {
    padding: 9px 0;
  
  }
    .container {
    padding-top: 100px;
  }

    .finish {
    padding-top: 250px;
    padding-right: 25px;
    padding-left: 25px;
  }
  

  
  @media (max-width: 980px) {
    /* Enable use of floated navbar text */
    .navbar-text.pull-right {
      float: none;
      padding-left: 5px;
      padding-right: 5px;
    }
  }
</style>

</head>

<body>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap.js"></script>

<div class="navbar navbar-inverse navbar-fixed-top">
	<div class="navbar-inner">
		<div class="container-fluid">
			<button type="button" class="btn btn-navbar" data-toggle="collapse"
				data-target=".nav-collapse">
				<span class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="brand" href="http://localhost/bases--grupo10/homeAdmin.php?">My project manager</a>
			<div class="nav-collapse collapse">
				<p class="navbar-text pull-right">
				
					<a href="http://localhost/bases--grupo10/logout.php?" class="navbar-link">Log out</a>
				</p>
				<ul class="nav">
					<li class="active"><a href="http://localhost/bases--grupo10/homeAdmin.php?">Home</a></li>
					<li><a href="http://localhost/bases--grupo10/about.php?">About</a></li>
					<li><a href="http://localhost/bases--grupo10/contact.php?">Contact</a></li>
				</ul>
			</div>
		</div>
	</div>
</div>

<div class="span12">
	<h1 class="muted">Modify member > </h1>
	<h1 style="font-weight:bold"><font size="5">Make changes</font></h1>
</div>	


<form class="form-horizontal" method="post" action="modifyMember3.php" >	
    <div class="container">
    	<div class="span12">
    	<div class="container-fluid">	    
            <div class="control-group">
                 <label class="control-label" for="inputName">Name</label>
                 <div class="controls">
                    <input type="text" id="name" name="name" value="<?php echo $name;?>">
             </div>
         </div>
         <div class="control-group">
             <label class="control-label" for="inputsurname1">Surname 1</label>
             <div class="controls">
                <input type="text" id="surnames" name="surnames" value="<?php echo $surname;?>">
             </div>
         </div>
         <div class="control-group">
             <label class="control-label" for="inputemail">Email</label>
             <div class="controls">
                <input type="text" id="email" name="email" value="<?php echo $email?$email:"";?>">
             </div>
         </div>
         <div class="control-group">
             <div class="controls">
                <input type="hidden" id="id" name="id" value="<?php echo $id_usu;?>">
                 </div>
             </div>        
        </div>
        </div>	
    </div>		
    
    <div class="finish">
       <input class="btn btn-primary pull-right" type="submit" value="Modify" >  
       <a class="btn btn-primary pull-left" type="button" href="http://localhost/bases--grupo10/modifyMember.php?" >Back</a>	
    </div>
</form>

</body>
</html>

<?php
}
}endif;?>